//заготовки
//'{"EncryptType": "MD5", "LoginType": "DVRIP-Web", "PassWord": "00000000", "UserName": "admin"}'
char login_packet_bytes[] = {
  0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x03,
  0x5f, 0x00, 0x00, 0x00, 0x7b, 0x22, 0x45, 0x6e,
  0x63, 0x72, 0x79, 0x70, 0x74, 0x54, 0x79, 0x70,
  0x65, 0x22, 0x3a, 0x20, 0x22, 0x4d, 0x44, 0x35,
  0x22, 0x2c, 0x20, 0x22, 0x4c, 0x6f, 0x67, 0x69,
  0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x20,
  0x22, 0x44, 0x56, 0x52, 0x49, 0x50, 0x2d, 0x57,
  0x65, 0x62, 0x22, 0x2c, 0x20, 0x22, 0x50, 0x61,
  0x73, 0x73, 0x57, 0x6f, 0x72, 0x64, 0x22, 0x3a,
  0x20, 0x22, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
  0x30, 0x30, 0x22, 0x2c, 0x20, 0x22, 0x55, 0x73,
  0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3a,
  0x20, 0x22, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x22,
  0x7d, 0x0a, 0x00
};
//'{"Name": "fVideo.OSDInfo", "SessionID": "0x00000002", "fVideo.OSDInfo": {"OSDInfo": [{"Info": ["0", "0", "0"], "OSDInfoWidget": {"BackColor": "0x00000000", "EncodeBlend": true, "FrontColor": "0xF0FFFFFF", "PreviewBlend": true, "RelativePos": [6144, 6144, 8192, 8192]}}], "strEnc": "UTF-8"}}'
char set_packet_bytes[] = {
  0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x04,
  0x24, 0x01, 0x00, 0x00, 0x7b, 0x22, 0x4e, 0x61,
  0x6d, 0x65, 0x22, 0x3a, 0x20, 0x22, 0x66, 0x56,
  0x69, 0x64, 0x65, 0x6f, 0x2e, 0x4f, 0x53, 0x44,
  0x49, 0x6e, 0x66, 0x6f, 0x22, 0x2c, 0x20, 0x22,
  0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49,
  0x44, 0x22, 0x3a, 0x20, 0x22, 0x30, 0x78, 0x30,
  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32, 0x22,
  0x2c, 0x20, 0x22, 0x66, 0x56, 0x69, 0x64, 0x65,
  0x6f, 0x2e, 0x4f, 0x53, 0x44, 0x49, 0x6e, 0x66,
  0x6f, 0x22, 0x3a, 0x20, 0x7b, 0x22, 0x4f, 0x53,
  0x44, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x3a, 0x20,
  0x5b, 0x7b, 0x22, 0x49, 0x6e, 0x66, 0x6f, 0x22,
  0x3a, 0x20, 0x5b, 0x22, 0x30, 0x22, 0x2c, 0x20,
  0x22, 0x30, 0x22, 0x2c, 0x20, 0x22, 0x30, 0x22,
  0x5d, 0x2c, 0x20, 0x22, 0x4f, 0x53, 0x44, 0x49,
  0x6e, 0x66, 0x6f, 0x57, 0x69, 0x64, 0x67, 0x65,
  0x74, 0x22, 0x3a, 0x20, 0x7b, 0x22, 0x42, 0x61,
  0x63, 0x6b, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x22,
  0x3a, 0x20, 0x22, 0x30, 0x78, 0x30, 0x30, 0x30,
  0x30, 0x30, 0x30, 0x30, 0x30, 0x22, 0x2c, 0x20,
  0x22, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x42,
  0x6c, 0x65, 0x6e, 0x64, 0x22, 0x3a, 0x20, 0x74,
  0x72, 0x75, 0x65, 0x2c, 0x20, 0x22, 0x46, 0x72,
  0x6f, 0x6e, 0x74, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
  0x22, 0x3a, 0x20, 0x22, 0x30, 0x78, 0x46, 0x30,
  0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x22, 0x2c,
  0x20, 0x22, 0x50, 0x72, 0x65, 0x76, 0x69, 0x65,
  0x77, 0x42, 0x6c, 0x65, 0x6e, 0x64, 0x22, 0x3a,
  0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x22,
  0x52, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65,
  0x50, 0x6f, 0x73, 0x22, 0x3a, 0x20, 0x5b, 0x36,
  0x31, 0x34, 0x34, 0x2c, 0x20, 0x36, 0x31, 0x34,
  0x34, 0x2c, 0x20, 0x38, 0x31, 0x39, 0x32, 0x2c,
  0x20, 0x38, 0x31, 0x39, 0x32, 0x5d, 0x7d, 0x7d,
  0x5d, 0x2c, 0x20, 0x22, 0x73, 0x74, 0x72, 0x45,
  0x6e, 0x63, 0x22, 0x3a, 0x20, 0x22, 0x55, 0x54,
  0x46, 0x2d, 0x38, 0x22, 0x7d, 0x7d, 0x0a, 0x00
};

char str1[] = "Test: 1";
char str2[] = "Test: 2";
char str3[] = "Test: 3";

memcpy( &login_packet_bytes[83], "00000000", 8 );//set password hash(83..88)
client.write(login_packet_bytes);
char income[20] = client.read(20)
int len = 289+sizeof(str1)+sizeof(str2)+sizeof(str3);
char buff[len];
int offset = 0;
memcpy( &buff[4], $income[4], 4 );//4...7 - session id
memcpy( &buff[16], &len, 2);//set len 16..17 - bytes
//TO DO: set session hex str
//70...63 - hex string session
memcpy( &buff[offset], &set_packet_bytes[0], 116);
//116 str1
//121 str2
//126 str3
offset += 116;
memcpy( &buff[offset], &str1[0], sizeof(str1));//set str1
offset +=sizeof(str1);
memcpy( &buff[offset], &set_packet_bytes[117], 4);
offset += 4;
memcpy( &buff[offset], &str2[0], sizeof(str2));//set str2
offset += sizeof(str2);
memcpy( &buff[offset], &set_packet_bytes[117], 4);
offset += 4;
memcpy( &buff[offset], &str3[0], sizeof(str3));//set str3
offset += sizeof(str3);
memcpy( &buff[offset], &set_packet_bytes[127], 185);
offset += 38;
memcpy( &buff[offset], "00000000", 8 );//BG color
offset += 41;
memcpy( &buff[offset], "F0FFFFFF", 8 );//FG color
//Serial.write(buff);//debug
client.write(buff);
client.close();
